<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>导航条</title>
    <script src="jquery-3.1.1.js"></script>
    <style>
        body {
            height: 2000px;
        }
        
        ul#nav li {
            width: 100px;
        }
        
        ul#nav {
            position: fixed;
            margin: 0;
            padding: 0;
            top: 10px;
            left: 0px;
            list-style: none;
            z-index: 9999;
        }
        /*对列表链接定义css属性*/
        ul#nav li a {
            display: block;
            width: 100px;
            height: 70px;
            background-color: #cfcfcf;
            background-repeat: no-repeat;
            background-position: center;
            border: 1px solid #afafaf;
            border-radius: 10px;
            opacity: 0.6;
        }
        /*给每个链接定义背景*/
        ul#nav .home a {
            background-image: url(images/home.png);
        }
        
        ul#nav .about a {
            background-image: url(images/id_card.png);
        }
        
        ul#nav .search a {
            background-image: url(images/search.png);
        }
        
        ul#nav .podcasts a {
            background-image: url(images/ipod.png);
        }
        
        ul#nav .rssfeed a {
            background-image: url(images/rss.png);
        }
        
        ul#nav .photos a {
            background-image: url(images/camera.png);
        }
        
        ul#nav .contact a {
            background-image: url(images/mail.png);
        }
    </style>
</head>

<body>
    <div class="header"></div>
    <div class="scroll"></div>
    <ul id="nav">
        <li class="home">
            <a href=""></a>
        </li>
        <li class="about">
            <a href=""></a>
        </li>
        <li class="search">
            <a href=""></a>
        </li>
        <li class="photos">
            <a href=""></a>
        </li>
        <li class="rssfeed">
            <a href=""></a>
        </li>
        <li class="podcasts">
            <a href=""></a>
        </li>
        <li class="contact">
            <a href=""></a>
        </li>
    </ul>
</body>

</html>
<script>
    $(function(){
        $(function(){
            $('#nav a').stop().animate({'marginLeft':'-85px'},1000)
        })
        $('#nav>li').hover(function(){
                                            // 自作边距-2进行显示
            $('a',$(this)).stop().animate({'marginLeft':'-2px'},200)
        },function(){                      //左边距-85 隐藏
            $('a',$(this)).stop().animate({'marginLeft':'-85px'},200);
        })
    })
</script>